proc remchan {nick chan otbn1 handle host} {
global botnick home bcast

#in theory, we should be checking if the room is flagged as the home chan, but we don't need to cuz this is x-bot ;P
if {($otbn1 == $home)} {
  putquick "NOTICE $nick :\0034Unable To Execute Command - Home channel cannot be removed from channel partition - Permission Denied."
if {$bcast == "1"} {
  putquick "PRIVMSG $home :\002$nick\002 ($host) tried to remove \002$home\002 - The current home channel on me."
  }
  return 0
  }
if {$otbn1 == ""} {
  putquick "NOTICE $nick :\0034ERROR - Invalid Syntax - Should Be - (/msg) $botnick remchan <#channel>"
  return 0
  }
if {![string match "#*" $otbn1]} {
  putquick "NOTICE $nick :\0034ERROR - Illegal Channel Name - Try adding a # in front of it (eg. #bot-solutions)"
  return 0
  }
if {![validchan $otbn1]} {
  putquick "NOTICE $nick :\0034ERROR - Channel Not Found - The Channel $otbn1 could not be found in my channel partition."
  return 0
  }
  putlog "!$nick ($host)! remchan $otbn1"
  putquick "NOTICE $nick :Sucessfully removed $otbn1 from channel partition."
if {$bcast == "1"} {
  putquick "PRIVMSG $home :\002$nick\002 ($host) requested me to remchan \002$otbn1\002 from my channel partition."
  }
  foreach user [userlist]  {
  set userdeluser 1
if {[delchanrec $user $otbn1]} {
  save
if {![matchattr $user f]} {
  foreach channels [channels] {
if {[matchattr $user |f $channels]} {
  set userdeluser 0
  }
  }
if {$userdeluser} {
  deluser $user
  channel remove $otbn1
  save		
  return 0
  }		
  }
  }
  }
  channel remove $otbn1
  save
  }









